﻿<%@ Page Language="C#" MasterPageFile="~/Design/MasterPage/MasterPage.master" AutoEventWireup="true" CodeFile="NotifyMessageUpdForm.aspx.cs" Inherits="App_Input_NotifyMessageUpdForm" Title="公告消息" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script language="javascript">
        function listBoxToString(cntId) {
            var s = "";
            var token = "";
            var obj = document.getElementById(cntId);
            var e;

            try {
                for(var i=0; obj!=null && i<obj.options.length; i++) {
                    s += token + obj.options[i].value;
                    s += ",";
                    s += obj.options[i].text;
                    
                    token = ",";
                }
            }
            catch(e) {
                alert(e.message);
            }

            return s;
        }
        
        function listBoxValueToString(cntId) {
            var s = "";
            var token = "";
            var obj = document.getElementById(cntId);
            var e;

            try {
                for(var i=0; obj!=null && i<obj.options.length; i++) {
                    s += token + obj.options[i].value;
                    token = ",";
                }
            }
            catch(e) {
                alert(e.message);
            }

            return s;
        }

        function setStringToListBox(cntId, s) {
            var obj = document.getElementById(cntId);
            var list = s.split(",");

            if( obj!=null ) {
                obj.options.length = 0;
                for(var i=0; i<list.length; i+=2) {
                    obj.add( new Option(list[i+1], list[i]) );
                }
            }
        }

        function showDepartPopup() {
            var url = 'NotifyMessageDepartForm.aspx';
            url += '?departId='+listBoxValueToString('<%=lstDepartId.ClientID %>');
            url += '&cntId=<%=lstDepartId.ClientID%>';
            window.open(url, 'MessageDepart', 'scrollbars,resizable,height=338,width=480');
        }
        
        function onBtnOkClick() {
            if( confirm('是否发送？') ) {
                document.getElementById('<%=hidDepartId.ClientID %>').value = listBoxValueToString('<%=lstDepartId.ClientID %>');
                return true;
            }
            else 
                return false;
        }
        
        function removeOption() {
            var obj = document.getElementById('<%=lstDepartId.ClientID %>');
            for(var i=obj.length-1; i>=0; i--) {
                if( obj.options[i].selected ) 
                obj.remove(obj.selectedIndex);
            }
        }
    </script>
    <script language="javascript">
            (new TitleBar('NotifyBar', '发布公告')).showBar();
    </script>
    <table class="table_border_line" style="background: ffffff">
        <tr>
            <td style="width: 16px" class="">
                &nbsp;
            </td>
            <td class="" style="width: 75px; height: 26px; text-align:right">
                 发布部门：
            </td>
             <td >
                <asp:DropDownList ID="ddlDepartId" runat="server" DataTextField="DepartName" DataValueField="DepartId" />
            </td>
        </tr>
        <tr>
            <td style="width: 16px" class="">
                &nbsp;
            </td>
            <td class="" style="width: 75px; height: 26px; text-align:right">
                <span style="color: #ff7300">*</span>标题：
            </td>
             <td >
                <asp:TextBox ID="txtTitle" runat="server" Width="96%" />
            </td>
        </tr>
        <tr>
            <td style="width: 16px" class="">
                &nbsp;
            </td>
            <td class="" style="width: 75px; height: 26px; text-align:right">
                <span style="color: #ff7300">*</span>内容：
            </td>
             <td >
                <asp:TextBox ID="txtMessageBody" runat="server" TextMode="MultiLine" Rows="6" Columns="38" Width="96%" />
            </td>
        </tr>
    </table>
    
    <p>&nbsp;</p>
    
    <script language="javascript">
            (new TitleBar('DestBar', '接收部门')).showBar();
    </script>
    <table class="table_border_line" style="background: ffffff">
        <tr>
            <td style="width: 16px">
                <br />
            </td>
            <td style="padding-top:3px;padding-bottom:3px">
                <select id="lstDepartId" size="6" style="width:96%" runat="server" multiple="true">
                </select>    
            </td>
                
             <td >
                <br />
            </td>
        </tr>
        <tr>
            <td style="width: 16px" class="">
                &nbsp;
            </td>
            <td align="center">
                <input type="button" id="btnAddDepart" value="添加部门" onclick="showDepartPopup()" />
                <input type="button" id="btnRemoveDepart" value="取消部门" onclick="removeOption()" />
            </td>
             <td >
                <br />
            </td>
        </tr>
    </table>

    <p>&nbsp;</p>
    
    <script language="javascript">
            (new TitleBar('PropertyBar', '公告属性')).showBar();
    </script>
    <table class="table_border_line" style="background: ffffff">
        <tr>
            <td style="width: 16px" class="">
                &nbsp;
            </td>
            <td style="padding-top:3px;padding-bottom:3px">&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:CheckBox ID="chkImportant" runat="server" Text="重要公告" />&nbsp;&nbsp;
                <asp:CheckBox ID="chkReply" runat="server" Text="必须回复" />&nbsp;&nbsp;
                <asp:CheckBox ID="chkReaderHistory" runat="server" Text="记录阅读情况" />
            </td>
             <td >
                <br />
            </td>
        </tr>
    </table>
    
    <p>&nbsp;</p>
    <p align="center">
    <asp:HiddenField ID="hidDepartId" runat="server" />
    <asp:Button ID="btnOk" runat="server" Text=" 发 布 " Width="95px" OnClick="btnOk_Click" OnClientClick="return onBtnOkClick()"/>
    <asp:Button ID="Button1" runat="server" Text=" 关 闭 " Width="95px" OnClientClick="window.close()" />
    </p>

</asp:Content>

